package cn.hehuoren.quartz.service;

import cn.hehuoren.quartz.model.QuartzManager;
import org.quartz.JobDetail;
import org.quartz.SchedulerException;
import org.quartz.UnableToInterruptJobException;

import java.util.Date;

public interface ISchedulerService {
	/**
	 * 逻辑中断
	 * @param quartz
	 * @return
	 * @throws UnableToInterruptJobException
	 */
	public boolean interrupt(QuartzManager quartz) throws UnableToInterruptJobException;
	/**
	 * 注册调度任务
	 * @param quartz
	 * @param jobClass
	 * @return
	 * @throws SchedulerException
	 * @throws ClassNotFoundException
	 */
	public Date registScheduleJob(QuartzManager quartz, Class jobClass) throws SchedulerException, ClassNotFoundException ,Exception;
	/**
	 * 修改
	 * @param quartz
	 * @param jobClass
	 * @return
	 * @throws SchedulerException
	 * @throws ClassNotFoundException
	 */
	public Date registScheduleJobUpdate(QuartzManager quartz, Class jobClass) throws SchedulerException, ClassNotFoundException;
	/**
	 * 修改调度任务
	 * @param quartz
	 * @return
	 * @throws SchedulerException
	 */
	public boolean deleteJob(QuartzManager quartz) throws SchedulerException ;
	/**
	 * 暂停调度任务
	 * @param quartz
	 * @throws SchedulerException
	 */
	public void pauseJob(QuartzManager quartz) throws SchedulerException ;
	/**
	 * 恢复调度任务
	 * @param quartz
	 * @throws SchedulerException
	 */
	public void resumeJob(QuartzManager quartz) throws SchedulerException;
	
	/**
	 * 暂停job任务执行
	 * @throws SchedulerException
	 */
	public void pauseJob() throws SchedulerException;
	/**
	 * 恢复job任务
	 * @throws SchedulerException
	 */
	public void resumeJob() throws SchedulerException;
	/**
	 * 手工触发
	 * @param quartz
	 * @throws SchedulerException
	 */
	public void triggerJob(QuartzManager quartz) throws SchedulerException;
	/**
	 * 判断调度是否启动
	 * @return
	 * @throws SchedulerException
	 */
	public boolean getStartStatus() throws SchedulerException ;
	/**
	 * 获取当前调度器名称
	 * @return
	 * @throws SchedulerException
	 */
	public String getSchedulerName() throws SchedulerException;
	/**
	 * 停止调度器
	 * @return
	 * @throws SchedulerException
	 */
	public  void shutdownScheduler() throws SchedulerException;
	
	public JobDetail getJobDetailByKey(String dtlJobName, String dtlJobGroup) throws SchedulerException;

	void sayHello();
}
